<template>
  <div>
    <el-form label-width="80px">
      <el-form-item label="年度">
        <el-input v-model="year"></el-input>
      </el-form-item>
      <el-form-item label="范围">
        <el-checkbox-group v-model="offices">
          <el-checkbox label="管制一室"></el-checkbox>
          <el-checkbox label="管制二室"></el-checkbox>
          <el-checkbox label="终端管制室"></el-checkbox>
        </el-checkbox-group>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="open">生成练习册</el-button>
      </el-form-item>
      <el-form-item>
        <p>
          单击“生成练习册”，在弹出的新窗口加载完成后，按键盘上的“Ctrl+P”或单击鼠标右键选择“打印”
        </p>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  name: "printExercises",
  data() {
    return {
      year: new Date().getFullYear(),
      offices: ["管制一室", "管制二室", "终端管制室"],
    };
  },
  methods: {
    open: function () {
      let url = `api/print_exercise_content.php?offices=${this.offices.join(
        ","
      )}&year=${this.year}`;
      return window.open(url, "_blank", "resizable,scrollbars,status");
    },
  },
};
// api/print_exercise_content.php?offices=管制二室&year=2024
</script>
